export const alphabet = '0123456789abcdef'
export const dec2hex16 = [...alphabet]
export const dec2hex = new Array<string>(256)
for (let i = 0; i < 256; i++) {
  dec2hex[i] = `${dec2hex16[(i >>> 4) & 0xF]}${dec2hex16[i & 0xF]}`
}
export const hex2dec: Record<string, number> = {}
for (let i = 0; i < 256; i++) {
  const hex = dec2hex[i]
  const firstLower = hex[0]
  const firstUpper = firstLower.toUpperCase()
  const lastLower = hex[1]
  const lastUpper = lastLower.toUpperCase()

  hex2dec[hex] = i
  hex2dec[`${firstLower}${lastUpper}`] = i
  hex2dec[`${firstUpper}${lastLower}`] = i
  hex2dec[`${firstUpper}${lastUpper}`] = i
}
